package com.leyou.test;

import com.aliyun.oss.OSS;
import com.leyou.LyUploadApplication;
import com.leyou.upload.config.OssConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = LyUploadApplication.class)
public class Demo {

    @Autowired
    private OSS ossClient;

    @Test
    public void test() throws FileNotFoundException {
        FileInputStream inputStream = new FileInputStream(new File("D:\\test\\18.jpg"));
        ossClient.putObject("ly-upload-lijiaoqiserver", "lijiaoqi.png" , inputStream);
        ossClient.shutdown();
    }

}
